;Raw graphic construction tool for square-to-round transitions (sheet metal)
(DEFUN C:TCL ( / )
  (setq cir_pt (upoint 1 "" "Pick Corner Point" cir_pt cir_pt))
  (setq l_line (entsel))
  (setq l_edat (entget (car l_line)))
  (setq l_len (distance (cdr(assoc 10 l_edat))(cdr(assoc 11 l_edat))))
  (setq cir_rad (sqrt(+(* l_len l_len)100)))
  (command ".circle" cir_pt cir_rad "")
);defun
(DEFUN C:CCL ( / )
  (setq rnd_pt (upoint 1 "" "Pick Corner Point" rnd_pt rnd_pt))
  (setq l_line1 (entsel "Select Line 1: "))
  (setq l_line2 (entsel "Select Line 2: "))
  (setq l1_edat (entget (car l_line1)))
  (setq l2_edat (entget (car l_line2)))
  (cond
    ((equal (cdr(assoc 10 l1_edat))(cdr(assoc 10 l2_edat))0.0001)
      (setq com_pt (cdr(assoc 10 l1_edat))
            1st_pt (cdr(assoc 11 l1_edat))
	    2nd_pt (cdr(assoc 11 l2_edat))
      ))
    ((equal (cdr(assoc 10 l1_edat))(cdr(assoc 11 l2_edat))0.0001)
      (setq com_pt (cdr(assoc 10 l1_edat))
            1st_pt (cdr(assoc 11 l1_edat))
	    2nd_pt (cdr(assoc 10 l2_edat))
      ))
    ((equal (cdr(assoc 11 l1_edat))(cdr(assoc 11 l2_edat))0.0001)
      (setq com_pt (cdr(assoc 11 l1_edat))
            1st_pt (cdr(assoc 10 l1_edat))
	    2nd_pt (cdr(assoc 10 l2_edat))
      ))
    ((equal (cdr(assoc 11 l1_edat))(cdr(assoc 10 l2_edat))0.0001)
      (setq com_pt (cdr(assoc 11 l1_edat))
            1st_pt (cdr(assoc 10 l1_edat))
	    2nd_pt (cdr(assoc 11 l2_edat))
      ))
  )
  (setq big_ang (angle com_pt 2nd_pt)
        small_ang (angle com_pt 1st_pt))
  (if (equal big_ang 0 0.0001)
    (setq big_ang (* 2 pi))
  )
  (setq seg_ang (- big_ang small_ang))
  (setq seg_ratio (/ seg_ang (* 2 pi)))
  (setq rnd_rad (* seg_ratio pi 10))
  (command ".circle" rnd_pt rnd_rad "")
);defun
